@extends('layouts.admin.application')

@section('content')
    <div class="main-content">
        <div class="col-xs-12">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li><i class="icon-home home-icon"></i><a href="#">首页</a></li>
                    <li><a href="{{ route('system.user.index') }}">用户管理</a></li>
                    <li class="active">新增用户</li>
                </ul>
            </div>

            @include('layouts.partials._flash')

            <form class="form-horizontal" role="form" action="{{ route('system.user.store') }}" method="post"
                  style="margin-top: 20px;">

                {{csrf_field()}}

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">用户名：</label>

                    <div class="col-sm-9">
                        <input type="text" name="name" placeholder="请输入用户名" value="{{old('name')}}"
                               class="col-xs-10 col-sm-5">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">邮箱：</label>

                    <div class="col-sm-9">
                        <input type="email" name="email" class="col-xs-10 col-sm-5" value="{{old('email')}}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">密码：</label>

                    <div class="col-sm-9">
                        <input type="password" name="password" class="col-xs-10 col-sm-5">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">确认密码：</label>

                    <div class="col-sm-9">
                        <input type="password" name="password_confirmation" class="col-xs-10 col-sm-5">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">选择用户组：</label>

                    <div class="col-sm-8 col-md-9 col-end">
                        @foreach ($roles as $role)
                            <label class="checkbox-inline">
                                <input type="checkbox" value="{{$role->id}}" name="role_id[]"
                                       @if(old('role_id') && in_array($role->id, old('role_id'))) checked @endif>
                                {{$role->name}}
                            </label>
                        @endforeach
                    </div>
                </div>

                <div class="clearfix form-actions">
                    <div class="col-md-offset-3 col-md-9">
                        <button class="btn btn-info" type="submit"><i class="icon-ok bigger-110"></i>保存</button>
                        &nbsp; &nbsp; &nbsp;
                        <a class="btn" onclick="javascript:history.back(-1);return false;">
                            <i class="icon-undo bigger-110"></i>返回</a>
                    </div>
                </div>
            </form>
        </div>

    </div>
@endsection

@section('js')
    <script src="/vendor/pca/CityJson.js"></script>
    <script src="/vendor/pca/DistrictJson.js"></script>
    <script src="/vendor/pca/ProJson.js"></script>
    <script src="/vendor/pca/pca.js"></script>
@endsection